<template>
  <div>
    <el-button type="primary" @click="AddUser()">添加操作员</el-button>
    <el-button type="primary" @click="UpdateUser()">修改操作员</el-button>
    <el-button type="primary" @click="DeleteUser()">删除操作员</el-button>
    <el-button type="primary" @click="GetUser()">查询操作员</el-button>
    <el-button type="primary" @click="GetPageUser()">获取操作员</el-button>
  </div>
</template>

<script setup lang="ts">
import type { IUserInfo } from "@/models/IUserInfo";
import {
  UserInfo_AddData,
  UserInfo_DeleteData,
  UserInfo_GetData,
  UserInfo_UpdateData,
} from "@/http/UserInfo/apis";
import type { IQueryByIntID } from "@/models/IQueryByIntID";
import { UserInfo_GetPageData } from "@/http/UserInfo/apis";
import type { IBaseRequest } from "@/models/IBaseRequest";
/**添加操作员 */
const AddUser = async () => {
  let userInfo: IUserInfo = {
    name: "张三",
    password: "654321",
  };
  let result = await UserInfo_AddData(userInfo);
};
/**更新操作员 */
const UpdateUser = async () => {
  let userInfo: IUserInfo = {
    id: 3,
    name: "张三1",
    password: "6543210",
  };
  let result = await UserInfo_UpdateData(userInfo);
};
/**删除操作员 */
const DeleteUser = async () => {
  let id: IQueryByIntID = {
    id: 3,
  };
  let result = await UserInfo_DeleteData(id);
};
/**查询操作员 */
const GetUser = async () => {
  let id: IQueryByIntID = {
    id: 1,
  };
  let result = await UserInfo_GetData(id);
  // console.log("查询结果", result.result);
};
/**查询操作员 */
const GetPageUser = async () => {
  let id: IBaseRequest<IUserInfo> = {
    pageIndex: 1,
    pageSize: 1,
    sortColumns: "name",
    isAsc: true,
    queryCondition: {},
  };
  let result = await UserInfo_GetPageData(id);
  // console.log("查询结果", result.result);
  // console.log("数据详情", result.result.dataList);
};
</script>

<style scoped></style>
